-
Notifications
You must be signed in to change notification settings - Fork 91
Bunny/Total configuration conflict check #1234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: total-cdn-staging
Are you sure you want to change the base?
Conversation
…r certain conditions. Added missing check for total CDN to prevent enabling both CDN and FSD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors CDN conflict detection to prevent enabling Bunny CDN and Total CDN simultaneously for both CDN and Full Site Delivery (FSD). The implementation uses capture-phase event listeners to intercept changes before other handlers execute, and maintains a state tracker to revert conflicting selections.
- Extended conflict detection from Bunny CDN only to include Total CDN and mixed configurations
- Replaced the old
cdn_bunnycdn_check()with a comprehensivecdn_conflict_check()system using capture-phase event listeners - Added server-side validation in
Generic_AdminActions_Default.phpto block conflicting configurations on save
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pub/js/options.js | Replaced single-engine conflict check with comprehensive CDN/FSD conflict detection system using capture-phase listeners and state management |
| Generic_Plugin_Admin.php | Added warning messages for Total CDN and mixed CDN conflicts; updated Bunny CDN warning text |
| Generic_AdminActions_Default.php | Added server-side validation to prevent saving conflicting CDN configurations |
| Cdn_TotalCdn_FsdEnablePopup.js | Removed file (functionality replaced by refactored conflict detection system) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## total-cdn-staging #1234 +/- ##
=======================================================
- Coverage 2.28% 2.28% -0.01%
- Complexity 20218 20224 +6
=======================================================
Files 669 669
Lines 102088 102127 +39
=======================================================
Hits 2335 2335
- Misses 99753 99792 +39 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cssjoe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use W3TC_CDN_NAME instead of "Total CDN".
| ), | ||
| 'pull_zone' => __( 'Pull Zone could not be automatically created.', 'w3-total-cache' ), | ||
| 'cdn_fsd_conflict_bunnycdn' => esc_html__( 'Bunny CDN cannot be enabled for both CDN and Full Site Delivery. Please disable one and save again.', 'w3-total-cache' ), | ||
| 'cdn_fsd_conflict_totalcdn' => esc_html__( 'Total CDN cannot be enabled for both CDN and Full Site Delivery. Please disable one and save again.', 'w3-total-cache' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use W3TC_CDN_NAME instead of "Total CDN".
| 'pull_zone' => __( 'Pull Zone could not be automatically created.', 'w3-total-cache' ), | ||
| 'cdn_fsd_conflict_bunnycdn' => esc_html__( 'Bunny CDN cannot be enabled for both CDN and Full Site Delivery. Please disable one and save again.', 'w3-total-cache' ), | ||
| 'cdn_fsd_conflict_totalcdn' => esc_html__( 'Total CDN cannot be enabled for both CDN and Full Site Delivery. Please disable one and save again.', 'w3-total-cache' ), | ||
| 'cdn_fsd_conflict_mixed' => esc_html__( 'Bunny CDN and Total CDN cannot be enabled across CDN and Full Site Delivery at the same time. Please disable one and save again.', 'w3-total-cache' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use W3TC_CDN_NAME instead of "Total CDN".
| ), | ||
| 'updated_pullzone_url' => __( 'Pull Zone URL could not be automatically updated. Please contact support for assistance.', 'w3-total-cache' ), | ||
| 'cdn_totalcdn_fsd_origin_update_failed' => __( 'Unable to update the Total CDN origin for Full Site Delivery. Please contact support for assistance.', 'w3-total-cache' ), | ||
| 'cdn_totalcdn_fsd_origin_update_failed' => __( 'Unable to update the Total CDN origin for Full Site Delivery. Please contact support for assistance.', 'w3-total-cache' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use W3TC_CDN_NAME instead of "Total CDN".
| 'w3-total-cache' | ||
| ), | ||
| 'totalCdnWarning' => esc_html__( | ||
| 'Total CDN cannot be enabled for both CDN and Full Site Delivery.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use W3TC_CDN_NAME instead of "Total CDN".
| 'w3-total-cache' | ||
| ), | ||
| 'mixedCdnWarning' => esc_html__( | ||
| 'Bunny CDN and Total CDN cannot be enabled across CDN and Full Site Delivery at the same time.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use W3TC_CDN_NAME instead of "Total CDN".
This PR does 2 things
One thing to note is that the conflict check prevents mixing Bunny and Total for CDN/FSD
To test simply visit the General Settings page and attempt to configure. On conflict it should revert the last changed setting and show a warning
Lastly the conflict check should prevent the Total FSD confirmation popup from executing if the configuration is in conflict